﻿using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using MyDay13.Context;
using MyDay13.IRepostitype;
using MyDay13.IService;
using MyDay3.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace MyDay13.Controllers
{
    [Route("api/[controller]")]
    [ApiController]
    public class TreeController : ControllerBase
    {

        ITreeService tree;
      
        public TreeController(ITreeService treeService,Day13Context dbs)
        {
            tree = treeService;
           
        }
        [HttpGet]
        [Route("Login")]
        public IActionResult Login(string name, string pwd)
        {
            return Ok(tree.Login(name, pwd));
        }
        [HttpGet]
        [Route("MenoShow")]
        public IActionResult MenoShow(int pid)
        {
            return Ok(tree.MenoShow(pid));
        }
        [HttpGet]
        [Route("PrwerShow")]
        public IActionResult PrwerShow(int pid)
        {
            return Ok(tree.PrwerShow(pid));
        }
        [HttpGet]
        [Route("RPShow")]
        public IActionResult RPShow()
        {
            return Ok(tree.RPShow());
        }
        [HttpGet]
        [Route("URShow")]
        public IActionResult URShow()
        {
            return Ok(tree.URShow());
        }
        [HttpGet]
        [Route("RPdistribution")]
        public IActionResult RPdistribution(int rid, string pid)
        {
            return Ok(tree.RPdistribution(rid, pid));
        }
        [HttpGet]
        [Route("URdistribution")]
        public IActionResult URdistribution(int uid, string rid)
        {
            return Ok(tree.URdistribution(uid, rid));
        }
        [HttpGet]
        [Route("URPShow")]
        public IActionResult URPShow(int id)
        {
            return Ok(tree.URPShow(id));
        }
    }
}
